import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author YuanYuan
 * @Date 2022/11/20
 * @Time 14:45
 */
@WebServlet("/status")
public class StatusServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String type = req.getParameter("type");
        if(type.equals("1")) {
            resp.setStatus(200);
        }else if(type.equals("2")) {
            resp.setStatus(404);
        }else if(type.equals("3")) {
            resp.setStatus(500);
        }else {
            resp.setStatus(504);
        }
    }
}
